package org.jeecg.enums.car;

/**
 * 商户停车减免优惠券"状态：0 未使用  1已发送 2 已使用  -1已失效"
 */
public enum CarDerateStatusEnum {
    CAR_DERATE_STATUS_0(0, "未使用"),
    CAR_DERATE_STATUS_1(1, "已发送"),
    CAR_DERATE_STATUS_2(2, "已使用"),
    CAR_DERATE_STATUS_MISS(-1,"已失效"),
    ;

    private Integer code;
    private String desc;

    CarDerateStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        CarDerateStatusEnum[] enums = values();
        for (CarDerateStatusEnum typeEnum : enums) {
            if (value.intValue()  == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        CarDerateStatusEnum[] enums = values();
        for (CarDerateStatusEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }

}
